import type { RowType } from '#/views/onlineDesign/designPage/designPage.data';

import { requestClient } from '#/api/request';

export namespace DesignPageTableApi {
  export type RowTypeFetchParams = RowType;
  export interface IdFetchParams {
    id: string;
  }
  export interface ListFetchParams {
    [key: string]: any;
  }
  export interface PageListFetchParams {
    [key: string]: any;
    pageNo: number;
    pageSize: number;
  }
}

/**
 * 分页列表查询
 */
export async function designPageQueryPageListApi(
  params: DesignPageTableApi.PageListFetchParams,
) {
  return requestClient.get('/gen/designPage/queryPageList', {
    params,
  });
}

/**
 * 列表查询
 */
export async function designPageQueryListApi(
  params: DesignPageTableApi.ListFetchParams,
) {
  return requestClient.get('/gen/designPage/queryList', { params });
}

/**
 * 通过ID查询
 * @param params
 */
export async function designPageQueryByIdApi(
  params: DesignPageTableApi.IdFetchParams,
) {
  return requestClient.get('/gen/designPage/queryById', { params });
}

/**
 * 新增
 */
export async function designPageAddApi(
  params: DesignPageTableApi.RowTypeFetchParams,
) {
  return requestClient.post('/gen/designPage/add', params);
}

/**
 * 编辑
 */
export async function designPageEditApi(
  params: DesignPageTableApi.RowTypeFetchParams,
) {
  return requestClient.post('/gen/designPage/edit', params);
}

/**
 * 删除
 * @param id 主键
 */
export async function designPageDelApi(id) {
  return requestClient.delete<boolean>(`/gen/designPage/delete/${id}`);
}

/**
 * 批量删除删除
 * @param ids 主键
 */
export async function designPageDeleteBatchApi(ids) {
  return requestClient.delete<boolean>(
    `/gen/designPage/deleteBatchByIds/${ids}`,
  );
}
